Workflow memo...
---------------------

Clone this repository :

    git clone https://notabug.org/ik7mt-minetest/minetest_az

Make changes, add, commit
Any commit that impact a subtree will be repercuted when pushing it

---------------------------------

### Pull latest updates from upstream

#### Update (pull) from minetest_game

Add minetest_game repo as upstream and pull

    git remote add upstream https://github.com/minetest/minetest_game
    git pull --no-rebase upstream master

#### Update (pull) a specific mod

    git subtree --prefix mods/az_mods/<path> pull <url> <branch> --squash

#### Add a new mod

    git subtree add --prefix mods/az_mods/<path> <url> <branch> --squash

---------------------------------

### Push changes

#### Push changes to this repo

    git push origin master

#### Push changes to a subtree

    git subtree -prefix <path> push <url> <branch>

Note : When parent repo as many commits, this might fail due to recursion limitation in the script environement. Because of that, it might be preferable to make changes to the other mod separately and use subtree pull instead.

##### E.g. push changes to az_mods

    git subtree push -prefix mods/az_mods/ https://notabug.org/ik7mt-minetest/az_mods master

##### E.g. push changes some other mod

    git subtree push -prefix mods/az_mods/mods_tools/marker_tool https://notabug.org/ik7mt-minetest/marker_tool master


---------------------------------

### Other things

#### Making sure local directory is completly identical with origin

One way is to delete the folder and re-clone it.

The other way is :

    git fetch origin
    git rm --cached -r .
    git add .
    git reset --hard HEAD
    git clean -df

See: https://stackoverflow.com/a/31099065

---------------------------------

#### List subtrees

    git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq | xargs -I {} bash -c 'if [ -d $(git rev-parse --show-toplevel)/{} ] ; then echo {}; fi'

See : https://gist.github.com/SKempin/b7857a6ff6bddb05717cc17a44091202?permalink_comment_id=3042352#gistcomment-3042352
